package com.h3c.ptability.task;

import com.h3c.ptability.service.IPtManagementAllService;
import com.xxl.job.core.biz.model.ReturnT;
import com.xxl.job.core.handler.IJobHandler;
import com.xxl.job.core.handler.annotation.JobHandler;
import com.xxl.job.core.log.XxlJobLogger;
import org.springframework.stereotype.Component;

import javax.annotation.Resource;

/**
 * @author :h24002
 * @date :2023/5/5 13:30
 * @description :同步各级主管数据（在职的）
 */
@JobHandler(value = "syncAllManagerHandler")
@Component
public class SyncAllManagerHandler extends IJobHandler {
    /**
     * 主管服务
     */
    @Resource
    private IPtManagementAllService ptManagementAllService;

    /**
     * 同步主管数据
     *
     * @param param 入参，无用
     * @return 同步主管数据结果
     * @throws Exception 处理过程中异常
     */
    @Override
    public ReturnT<String> execute(String param) throws Exception {
        XxlJobLogger.log("XXL-JOB, syncAllManagerHandler.");
        XxlJobLogger.log("准备开始调用方法");
        ptManagementAllService.syncAllManager();
        XxlJobLogger.log("调用结束");
        return SUCCESS;
    }
}
